import type { RouteRecordRaw } from 'vue-router';

const routes: RouteRecordRaw[] = [
  {
    path: '/',
    redirect: (to) => {
      // 保留查询参数（特别是 redirect 参数）
      return {
        path: '/login',
        query: to.query,
      };
    },
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import('../views/Login.vue'),
    meta: {
      title: '登录',
    },
  },
  {
    path: '/social-callback',
    name: 'SocialCallback',
    component: () => import('../views/SocialCallback.vue'),
    meta: {
      title: '社交登录回调',
    },
  },
  {
    path: '/user-agreement',
    name: 'UserAgreement',
    component: () => import('../views/UserAgreement.vue'),
    meta: {
      title: '用户服务协议',
    },
  },
  {
    path: '/privacy-policy',
    name: 'PrivacyPolicy',
    component: () => import('../views/PrivacyPolicy.vue'),
    meta: {
      title: '隐私政策',
    },
  },
  {
    path: '/terms-of-service',
    name: 'TermsOfService',
    component: () => import('../views/TermsOfService.vue'),
    meta: {
      title: '服务条款',
    },
  },
  {
    path: '/help-center',
    name: 'HelpCenter',
    component: () => import('../views/HelpCenter.vue'),
    meta: {
      title: '帮助中心',
    },
  },
];

export default routes;
